<script type="text/javascript">
$(document).ready(function(){
	var data = JSON.parse($(".s_temple_setting.profile_settings").html());
	console.log(data);
	$(".s_d_p_image").attr("src",data.profile.head_image_path).zoomify();
	$(".s_d_p_name").html(data.profile.name);
	s_d_p_addProfile("姓名（uid）:",data.profile.name+" ( "+data.profile.uid+" )","s_d_p_list");
	s_d_p_addProfile("性别:",data.profile.gender==0?"男":"女","s_d_p_list");
	s_d_p_addProfile("生日:",data.profile.birthday,"s_d_p_list");
	s_d_p_addProfile("用户类型:",data.profile.user_type==0?"学生":data.profile.user_type==1?"家长":"教职工","s_d_p_list");
	s_d_p_addProfile("座右铭:",data.profile.motto,"s_d_p_list");
	s_d_p_addProfile("自我介绍:",data.profile.introduce,"s_d_p_list");
	s_d_p_addProfile("手机:",data.loginData.phone,"s_d_p_list");
	s_d_p_addProfile("邮箱:",data.loginData.mail,"s_d_p_list");
	if(data.loginData.full){
		s_d_p_addProfile("注册时间:",data.loginData.registerdate,"s_d_p_list");
		s_d_p_addProfile("注册ip:",data.loginData.registerip,"s_d_p_list");
		s_d_p_addProfile("最后活动时间:",data.loginData.lastlogindate,"s_d_p_list");
		s_d_p_addProfile("最后活动ip:",data.loginData.lastloginip,"s_d_p_list");
		s_d_p_addProfile("登录次数:",data.loginData.logintotal,"s_d_p_list");
		if(data.loginData.isBanned==1){

			s_d_p_addProfile("账号状态:","已封禁","s_d_p_list");
			s_d_p_addProfile("解除时间:",data.loginData.bantime,"s_d_p_list");
			}else{
				s_d_p_addProfile("账号状态:","正常","s_d_p_list");
				}
		s_d_p_addProfile("最后活动ip:",data.loginData.lastloginip,"s_d_p_list");
	}
	readClassList(data.classData);
});

function s_d_p_addProfile(k,v,clazz,img){
	var $tmp = $("#s_d_p_temple").clone();
	$tmp.attr("style","");
	$tmp.find(".s_d_p_key").html(k);
	$tmp.find(".s_d_p_value").html(v);
	$("."+clazz).append($tmp);
}
function s_d_p_c_add(k,v,img){
	var $tmp = $("#s_d_p_c_temple").clone();
	$tmp.attr("style","");
	$tmp.find(".s_d_p_c_header").attr("src",img);
	$tmp.find(".s_d_p_key").html(k);
	$tmp.find(".s_d_p_value").html(v);
	$(".s_d_p_p_children").append($tmp);
}
function readClassList(classdata){
	if(classdata.isStudent){
		$(".s_d_p_s_header").attr("style","");
		s_d_p_addProfile("班级名称（classid）:",classdata["class"]["displayname"]+" ( "+classdata["class"]["classid"]+" )","s_d_p_s_class");
		s_d_p_addProfile("班级叙述:",classdata["class"]["description"],"s_d_p_s_class");
	}
	if(classdata.isTeacher){
		var master=-1;
		if(classdata.isMaster)
			master = classdata.masterClass;
		$(".s_d_p_t_header").attr("style","");
		$.each(classdata.classes,function(k,v){
			var name = v.classid==master?v.displayname+"(班主任)":v.displayname;
			s_d_p_addProfile(name+" ( "+v.classid+" )",v.description,"s_d_p_t_classes");
		});
	}
	if(classdata.isParent){
		$(".s_d_p_p_header").attr("style","");
		$.each(classdata.children,function(k,v){
			s_d_p_c_add("<a href='"+getHomeURL(v.uid)+"'a>"+v["card"]["name"]+"</a>",v["displayname"]+" ( "+v["classid"]+" )",v["card"]["head_image_path"]);
		});
	}
	loadAjaxEntry();
	
}
</script>
<h2>个人资料</h2>
<div class="s_temple_setting profile_settings"><?php print_json_setting("detial_profile");?></div>
<div class="ui feed">
	<div class="event">
		<div class="label">
			<img class="s_d_p_image zoomify">
		</div>
		<div class="content">
			<div class="summary s_d_p_name"></div>
		</div>
	</div>
</div>
<h4 class="ui dividing header">资料信息</h4>
<div class="ui relaxed divided list s_d_p_list"></div>
<div class="item" id="s_d_p_temple" style="display: none;">
	<div class="content">
		<div class="header s_d_p_key"></div>
		<div class="description s_d_p_value"></div>
	</div>
</div>
<div class="item" id="s_d_p_c_temple" style="display: none;">
	<img class="ui avatar image zoomify s_d_p_c_header">
	<div class="content">
		<div class="header s_d_p_key"></div>
		<div class="description s_d_p_value"></div>
	</div>
</div>
<h4 class="ui dividing header s_d_p_s_header" style="display: none;">学生身份：班级信息</h4>
<div class="ui relaxed divided list s_d_p_s_class"></div>
<h4 class="ui dividing header s_d_p_p_header" style="display: none;">家长身份：子女列表</h4>
<div class="ui relaxed divided list s_d_p_p_children"></div>
<h4 class="ui dividing header s_d_p_t_header" style="display: none;">教师身份：任教班级列表</h4>
<div class="ui relaxed divided list s_d_p_t_classes"></div>